package com.mark.web.data.controller.portal;

import com.mark.common.ServerResponse;
import com.mark.web.data.entity.vo.CategoryVo;
import com.mark.web.data.service.ICategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description: 商品种类
 * @Author: Mark
 * @CreateDate: 2018/8/14.
 * @Version: 2.0
 * @Copyright : 豆浆油条个人非正式工作室
 */
@Api(tags = "二手-(门户)商品种类")
@RestController
@RequestMapping("/category/")
public class CategoryController {

    private final ICategoryService iCategoryService;

    public CategoryController(ICategoryService iCategoryService) {
        this.iCategoryService = iCategoryService;
    }

    @ApiOperation(value = "获取categoryId下的商品子种类")
    @PostMapping(value = "get_category.do")
    @ApiImplicitParam(name = "categoryId",value = "商品种类父id",defaultValue = "0")
    public ServerResponse<List<CategoryVo>> getChildrenParallelCategory(@RequestParam(value = "categoryId" ,defaultValue = "0") Integer categoryId){
        List<CategoryVo> data = iCategoryService.getChildrenParallelCategory(categoryId);
        return ServerResponse.createBySuccess(data);
    }

}
